Contents | Index | < Browse | Browse >
XMPLFormat string for formatted outputUXMPL
An output format string consists of format commands and the output
characters. Format commands tell the output function how to convert a parameter
to character output. All characters, which build no format command, that is,
which do not start with the "%" percent sign, remain untouched and will be
written as passed to the output function.
The structure of format commands:
%[flags][width[.limit]][size]type
Arguments in angular brackets ('[' and ']') are optional.
MARKflagsUMARK
'-' justifies the output leftbound;
'+' causes positive numbers to be signed (prefixed with a '+');
'0' outputs leading zeros for numbers;
'#' outputs '0x' for hexadecimal numbers, '0' for octal numbers and trailing
zeros if 'g' or 'G' was chosen as type.
MARKwidthUMARK
The field width as a decimal number or '*', in this case the field width is
taken from the next argument in the argument queue. The field width is a
minimum value, too long output is not shortened.
MARKlimitUMARK
The precision as a decimal number or '*', in this case the precision is
taken from the next argument in the argument queue. This value describes the
maximum number of characters for strings, the minimum number of digits for
integer output or the precision for floating-point output.
MARKsizeUMARK
Specifies the size of the argument:
'h' stands for a short int or unsigned short int argument;
'l' stands for a long int or unsigned long int argument.
MARKtypeUMARK
Describes the type of the argument:
'd' and 'i' stand for a signed decimal number, the corrospending argument's
type is int.
'o' stands for an unsigned octal number, the corrospending argument's type
is int or unsigned int.
'x' stands for an unsigned hexadecimal number with lowercase letters, the
corrospending argument's type is int or unsigned int.
'X' stands for an unsigned hexadecimal number with uppercase letters, the
corrospending argument's type is int or unsigned int.
'u' stands for an unsigned decimal number, the corrospending argument's type
is unsigned int.
'c' stands for a character, the corrospending argument is int and will be
converted to unsigned char.
's' stands for a string terminated with a zero byte, the corrospending
argument's type is char *.
'f' stands for a floating-point number in decimal notation, the corrospending
argument's type is double.
'e' stands for a floating-point number in scientific notation using a lowercase
'e', the corrospending argument's type is double.
'E' stands for a floating-point number in scientific notation using an
uppercase 'E', the corrospending argument's type is double.
'g' stands for a floating-point number whose exponent determines the type of
notation. A lowercase 'e' will be used if scientific notation is chosen. The
corrospending argument's type is double.
'G' stands for a floating-point number whose exponent determines the type of
notation. An uppercase 'E' will be used if scientific notation is chosen. The
corrospending argument's type is double.
'p' stands for a hexadecimal memory address, the corrospending argument's type
is void *.
'n' is used to save the number of characters written so far in the variable
the argument is pointing to. The argument's type must be int *. This format
command creates no output.
'%' will output a percent sign.
The behaviour of all other commands is undefined.